﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;
using System.ComponentModel;
using QinTools.Model.Characters;
using GalaSoft.MvvmLight;

namespace QinTools.ViewModel
{
    public sealed class CharacterViewModel : ViewModelBase
    {
        public Character Model { get; set; }

        public CharacterViewModel() { }

        public CharacterViewModel(Character model)
        {
            Model = model;
            Model.PropertyChanged += new PropertyChangedEventHandler(Model_PropertyChanged);
        }

        void Model_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            RaisePropertyChanged(e.PropertyName);
        }

        public string Name
        {
            get
            {
                return Model.Name;
            }
            set
            {
                Model.Name = value;
            }
        }
        public string CharacterType
        {
            get
            {
                return Model.CharacterType;
            }
            set
            {
                Model.CharacterType = value;
            }
        }
        public string HomeState
        {
            get
            {
                return Model.HomeState;
            }
            set
            {
                Model.HomeState = value;
            }
        }
        public string Height
        {
            get
            {
                return Model.Height;
            }
            set
            {
                Model.Height = value;
            }
        }
        public string Weight
        {
            get
            {
                return Model.Weight;
            }
            set
            {
                Model.Weight = value;
            }
        }
        public string Gender
        {
            get
            {
                return Model.Gender;
            }
            set
            {
                Model.Gender = value;
            }
        }
        public string Age
        {
            get
            {
                return Model.Age;
            }
            set
            {
                Model.Age = value;
            }
        }
        public string Gift
        {
            get
            {
                return Model.Gift;
            }
            set
            {
                Model.Gift = value;
            }
        }
        public string Weakness
        {
            get
            {
                return Model.Weakness;
            }
            set
            {
                Model.Weakness = value;
            }
        }
        public string Renown
        {
            get
            {
                return Model.Renown.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.Renown = num;
                }
            }
        }
        public string Experience
        {
            get
            {
                return Model.Experience.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.Experience = num;
                }
            }
        }
        public string FireAspect
        {
            get
            {
                return Model.FireAspect.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.FireAspect = num;
                }
            }
        }
        public string MetalAspect
        {
            get
            {
                return Model.MetalAspect.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.MetalAspect = num;
                }
            }
        }
        public string EarthAspect
        {
            get
            {
                return Model.EarthAspect.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.EarthAspect = num;
                }
            }
        }
        public string WoodAspect
        {
            get
            {
                return Model.WoodAspect.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.WoodAspect = num;
                }
            }
        }
        public string WaterAspect
        {
            get
            {
                return Model.WaterAspect.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.WaterAspect = num;
                }
            }
        }
        public string NormalHp
        {
            get
            {
                return Model.NormalHp.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.NormalHp = num;
                }
            }
        }
        public string BruisedHp
        {
            get
            {
                return Model.BruisedHp.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.BruisedHp = num;
                }
            }
        }
        public string LightlyInjuredHp
        {
            get
            {
                return Model.LightlyInjuredHp.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.LightlyInjuredHp = num;
                }
            }
        }
        public string SeriouslyInjuredHp
        {
            get
            {
                return Model.SeriouslyInjuredHp.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.SeriouslyInjuredHp = num;
                }
            }
        }
        public string FatallyInjuredHp
        {
            get
            {
                return Model.FatallyInjuredHp.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.FatallyInjuredHp = num;
                }
            }
        }
        public string MaximumChi
        {
            get
            {
                return Model.MaximumChi.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.MaximumChi = num;
                }
            }
        }
        public string PassiveDefense
        {
            get
            {
                return Model.PassiveDefense.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.PassiveDefense = num;
                }
            }
        }
        public string Resistance
        {
            get
            {
                return Model.Resistance.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.Resistance = num;
                }
            }
        }
        public string ArmorName
        {
            get
            {
                return Model.ArmorName;
            }
            set
            {
                Model.ArmorName = value;
            }
        }
        public string ArmorProtection
        {
            get
            {
                return Model.ArmorProtection.ToString();
            }
            set
            {
                var num = 0;
                if (int.TryParse(value, out num))
                {
                    Model.ArmorProtection = num;
                }
            }
        }

        
    }
}